13 while (cin
>> n
&& n
){
15 vector
<pair
<int, int> > v(n
);
16 for (int i
=0; i
<n
; ++i
){
17 cin
>> v
[i
].first
>> v
[i
].second
;
19 vector
<pair
<int, int> > solution
;
22 sort(v
.begin(), v
.end());
25 for (int i
=0; i
<n
-1; ++i
){
26 t
+= hypot(v
[i
].first
-v
[i
+1].first
, v
[i
].second
-v
[i
+1].second
) + 16.0;
32 }while(next_permutation(v
.begin(), v
.end()));
34 printf("**********************************************************\n");
35 printf("Network #%d\n", N
++);
36 for (int i
=0; i
<n
-1; ++i
){
37 printf("Cable requirement to connect (%d,%d) to (%d,%d) is %.2f feet.\n",
38 solution
[i
].first
, solution
[i
].second
,
39 solution
[i
+1].first
, solution
[i
+1].second
,
40 hypot(solution
[i
].first
- solution
[i
+1].first
,
41 solution
[i
].second
- solution
[i
+1].second
) + 16.0);
43 printf("Number of feet of cable required is %.2f.\n", best
);